﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:odc="clr-namespace:Odyssey.Controls"
        xmlns:mwt="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/Odyssey;Component/Themes/Ribbon/DefaultRibbonButtonBrushes.xaml" />
        <ResourceDictionary Source="pack://application:,,,/Odyssey;Component/Themes/Ribbon/RibbonHLChromeStyle.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Thickness x:Key="{ComponentResourceKey odc:Skins, QABottomMargin}">2,4,2,4</Thickness>
    <CornerRadius x:Key="{ComponentResourceKey odc:Skins, QABottomCornerRadius}">3</CornerRadius>
    <Thickness x:Key="{ComponentResourceKey odc:Skins, QABottomBorderThickness}">1</Thickness>
    <SolidColorBrush x:Key="{ComponentResourceKey odc:Skins, RibbonQAToolbarBottomBgBrush}" Color="#30FFFFFF" />

    <Thickness x:Key="{ComponentResourceKey odc:Skins, QATopMargin}">-16,2,0,0</Thickness>
    <CornerRadius x:Key="{ComponentResourceKey odc:Skins, QATopCornerRadius}">0,10,10,0</CornerRadius>
    <Thickness x:Key="{ComponentResourceKey odc:Skins, QATopBorderThickness}">0,1,1,1</Thickness>
    <Visibility x:Key="{ComponentResourceKey odc:Skins, QALeftBorderShape}">Visible</Visibility>

    <Thickness x:Key="{ComponentResourceKey odc:Skins, QAOuterBorderThickness}">0</Thickness>
    <SolidColorBrush x:Key="{ComponentResourceKey odc:Skins, QAOuterBorderBrush}" Color="Transparent" />

    <SolidColorBrush x:Key="{ComponentResourceKey odc:Skins, RibbonQAToolbarBgBrush}" Color="#30FFFFFF" />

    <ControlTemplate x:Key="RibbonQAToolbarTemplateTop" TargetType="{x:Type odc:RibbonQAToolBar}">
        <Border Margin="{DynamicResource {ComponentResourceKey odc:Skins, QATopMargin}}" HorizontalAlignment="Left"
                BorderThickness="{DynamicResource {ComponentResourceKey odc:Skins, QAOuterBorderThickness}}"
                BorderBrush="{DynamicResource {ComponentResourceKey odc:Skins, QAOuterBorderBrush}}">
            <DockPanel Height="22">
                <Path Stroke="{DynamicResource {ComponentResourceKey odc:Skins, DefaultBorderBrush}}"
                        Visibility="{DynamicResource  {ComponentResourceKey odc:Skins, QALeftBorderShape}}" StrokeThickness="1.5"
                        Data="M20,0 L18,0 L0,0 A18,20 0 0,1 18,22 L20,22" SnapsToDevicePixels="False"
                        Fill="{DynamicResource {ComponentResourceKey odc:Skins, RibbonQAToolbarBgBrush}}" Width="18" Height="22"
                        Stretch="None" DockPanel.Dock="Left" />

                <odc:RibbonDropDownButton x:Name="overflowBtn" DockPanel.Dock="Right" Visibility="Collapsed" Margin="0,0,2,0"
                        odc:RibbonBar.Size="Medium" Foreground="Black" Width="16"
                        SmallImage="{DynamicResource {ComponentResourceKey odc:Skins, OverflowArrow}}" odc:RibbonButton.ImageStretch="None"
                        EdgeMode="Unspecified" PopupAnimation="Fade"
                        IsChecked="{Binding IsOverflowOpen, RelativeSource={RelativeSource TemplatedParent}}">
                    <odc:RibbonDropDownButton.DropDownHeader>
                        <StackPanel Orientation="Horizontal">
                            <odc:RibbonQAToolbarPanel Orientation="Horizontal" x:Name="PART_OverflowHost" />
                            <odc:RibbonDropDownButton DockPanel.Dock="Right" Margin="0,0,2,0" odc:RibbonBar.Size="Medium" Foreground="Black"
                                    odc:ImageRenderOptions.SmallImageScalingMode="Fant" EdgeMode="Unspecified"
                                    SmallImage="{DynamicResource {ComponentResourceKey odc:Skins, QAMenuArrow}}"
                                    odc:RibbonButton.ImageStretch="None" PopupAnimation="Fade" Width="16"
                                    IsChecked="{Binding IsMenuOpen, RelativeSource={RelativeSource TemplatedParent}}">
                                <odc:RibbonDropDownButton.DropDownHeader>
                                    <StackPanel>
                                        <ContentControl Content="{TemplateBinding MenuHeader}"
                                                ContentTemplate="{TemplateBinding MenuHeaderTemplate}" />
                                        <ContentControl ContentTemplate="{TemplateBinding ItemsTemplate}">
                                            <ContentControl.Content>
                                                <odc:RibbonQAToolbarPanel Orientation="Vertical" x:Name="PART_MenuItemOverflowHost"
                                                        Margin="2" />
                                            </ContentControl.Content>
                                        </ContentControl>
                                        <ContentControl Content="{TemplateBinding MenuFooter}"
                                                ContentTemplate="{TemplateBinding MenuFooterTemplate}" />
                                    </StackPanel>
                                </odc:RibbonDropDownButton.DropDownHeader>
                            </odc:RibbonDropDownButton>
                        </StackPanel>
                    </odc:RibbonDropDownButton.DropDownHeader>
                </odc:RibbonDropDownButton>

                <odc:RibbonDropDownButton x:Name="menuBtn" DockPanel.Dock="Right" Visibility="Collapsed" Margin="0,0,0,0"
                        odc:RibbonBar.Size="Medium" Foreground="Black" odc:ImageRenderOptions.SmallImageScalingMode="Fant"
                        EdgeMode="Unspecified" SmallImage="{DynamicResource {ComponentResourceKey odc:Skins, QAMenuArrow}}"
                        odc:RibbonButton.ImageStretch="None" PopupAnimation="Fade" Width="16"
                        IsChecked="{Binding IsMenuOpen, RelativeSource={RelativeSource TemplatedParent}}">
                    <odc:RibbonDropDownButton.DropDownHeader>
                        <StackPanel>
                            <ContentControl Content="{TemplateBinding MenuHeader}" ContentTemplate="{TemplateBinding MenuHeaderTemplate}" />
                            <ContentControl ContentTemplate="{TemplateBinding ItemsTemplate}">
                                <ContentControl.Content>
                                    <odc:RibbonQAToolbarPanel Orientation="Vertical" x:Name="PART_MenuItemHost" Margin="2" />
                                </ContentControl.Content>
                            </ContentControl>
                            <ContentControl Content="{TemplateBinding MenuFooter}" ContentTemplate="{TemplateBinding MenuFooterTemplate}" />
                        </StackPanel>
                    </odc:RibbonDropDownButton.DropDownHeader>
                </odc:RibbonDropDownButton>

                <Border CornerRadius="{DynamicResource {ComponentResourceKey odc:Skins, QATopCornerRadius}}" Panel.ZIndex="5"
                        BorderBrush="{DynamicResource {ComponentResourceKey odc:Skins, DefaultBorderBrush}}"
                        Background="{DynamicResource {ComponentResourceKey odc:Skins, RibbonQAToolbarBgBrush}}"
                        BorderThickness="{DynamicResource {ComponentResourceKey odc:Skins, QATopBorderThickness}}" Grid.Column="0"
                        Padding="2,0,10,0" Margin="0,0,0,0">
                    <odc:RibbonQAToolbarPanel Orientation="Horizontal" x:Name="PART_ToolBarPanel" />
                </Border>

            </DockPanel>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="HasMenuItems" Value="True">
                <Setter Property="Visibility" Value="Visible" TargetName="menuBtn" />
            </Trigger>
            <Trigger Property="HasOverflowItems" Value="True">
                <Setter Property="Visibility" Value="Visible" TargetName="overflowBtn" />
                <Setter Property="Visibility" Value="Collapsed" TargetName="menuBtn" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="RibbonQAToolbarTemplateBottom" TargetType="{x:Type odc:RibbonQAToolBar}">
        <Border CornerRadius="{DynamicResource {ComponentResourceKey odc:Skins, QABottomCornerRadius}}"
                BorderBrush="{DynamicResource {ComponentResourceKey odc:Skins, DefaultBorderBrush}}"
                Background="{DynamicResource {ComponentResourceKey odc:Skins, RibbonQAToolbarBottomBgBrush}}"
                BorderThickness="{DynamicResource {ComponentResourceKey odc:Skins, QABottomBorderThickness}}" Grid.Column="0"
                Padding="3,0,3,0" HorizontalAlignment="Stretch" Margin="{DynamicResource {ComponentResourceKey odc:Skins, QABottomMargin}}">
            <DockPanel Margin="1" HorizontalAlignment="Left" Height="22">
                <odc:RibbonDropDownButton x:Name="overflowBtn" DockPanel.Dock="Right" Visibility="Collapsed" Margin="0,0,2,0"
                        odc:RibbonBar.Size="Medium" Foreground="Black" Width="16" odc:ImageRenderOptions.SmallImageScalingMode="Fant"
                        EdgeMode="Unspecified" SmallImage="{DynamicResource {ComponentResourceKey odc:Skins, OverflowArrow}}"
                        odc:RibbonButton.ImageStretch="None" PopupAnimation="Fade"
                        IsChecked="{Binding IsOverflowOpen, RelativeSource={RelativeSource TemplatedParent}}">
                    <odc:RibbonDropDownButton.DropDownHeader>
                        <StackPanel Orientation="Horizontal">
                            <odc:RibbonQAToolbarPanel Orientation="Horizontal" x:Name="PART_OverflowHost" />
                            <odc:RibbonDropDownButton DockPanel.Dock="Right" Margin="0,0,2,0" odc:RibbonBar.Size="Medium" Foreground="Black"
                                    SmallImage="{DynamicResource {ComponentResourceKey odc:Skins, QAMenuArrow}}"
                                    odc:ImageRenderOptions.SmallImageScalingMode="Fant" odc:RibbonButton.ImageStretch="None"
                                    EdgeMode="Unspecified" PopupAnimation="Fade" Width="16"
                                    IsChecked="{Binding IsMenuOpen, RelativeSource={RelativeSource TemplatedParent}}">
                                <odc:RibbonDropDownButton.DropDownHeader>
                                    <StackPanel>
                                        <ContentControl Content="{TemplateBinding MenuHeader}"
                                                ContentTemplate="{TemplateBinding MenuHeaderTemplate}" />
                                        <ContentControl ContentTemplate="{TemplateBinding ItemsTemplate}">
                                            <ContentControl.Content>
                                                <odc:RibbonQAToolbarPanel Orientation="Vertical" x:Name="PART_MenuItemOverflowHost"
                                                        Margin="2" />
                                            </ContentControl.Content>
                                        </ContentControl>
                                        <ContentControl Content="{TemplateBinding MenuFooter}"
                                                ContentTemplate="{TemplateBinding MenuFooterTemplate}" />
                                    </StackPanel>
                                </odc:RibbonDropDownButton.DropDownHeader>
                            </odc:RibbonDropDownButton>
                        </StackPanel>
                    </odc:RibbonDropDownButton.DropDownHeader>
                </odc:RibbonDropDownButton>

                <odc:RibbonDropDownButton x:Name="menuBtn" DockPanel.Dock="Right" Visibility="Collapsed" Margin="0,0,2,0"
                        odc:RibbonBar.Size="Medium" Foreground="Black" odc:ImageRenderOptions.SmallImageScalingMode="Fant"
                        SmallImage="{DynamicResource {ComponentResourceKey odc:Skins, QAMenuArrow}}" odc:RibbonButton.ImageStretch="None"
                        PopupAnimation="Fade" Width="16" IsChecked="{Binding IsMenuOpen, RelativeSource={RelativeSource TemplatedParent}}">
                    <odc:RibbonDropDownButton.DropDownHeader>
                        <StackPanel>
                            <ContentControl Content="{TemplateBinding MenuHeader}" ContentTemplate="{TemplateBinding MenuHeaderTemplate}" />
                            <ContentControl ContentTemplate="{TemplateBinding ItemsTemplate}">
                                <ContentControl.Content>
                                    <odc:RibbonQAToolbarPanel Orientation="Vertical" x:Name="PART_MenuItemHost" Margin="2" />
                                </ContentControl.Content>
                            </ContentControl>
                            <ContentControl Content="{TemplateBinding MenuFooter}" ContentTemplate="{TemplateBinding MenuFooterTemplate}" />
                        </StackPanel>
                    </odc:RibbonDropDownButton.DropDownHeader>
                </odc:RibbonDropDownButton>
                <odc:RibbonQAToolbarPanel Grid.Column="0" Orientation="Horizontal" x:Name="PART_ToolBarPanel" />
            </DockPanel>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="HasMenuItems" Value="True">
                <Setter Property="Visibility" Value="Visible" TargetName="menuBtn" />
            </Trigger>
            <Trigger Property="HasOverflowItems" Value="True">
                <Setter Property="Visibility" Value="Visible" TargetName="overflowBtn" />
                <Setter Property="Visibility" Value="Collapsed" TargetName="menuBtn" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style TargetType="{x:Type odc:RibbonQAToolBar}">
        <Setter Property="Template" Value="{StaticResource RibbonQAToolbarTemplateTop}" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="MenuHeaderTemplate">
            <Setter.Value>
                <DataTemplate>
                    <TextBox Text="Customize Quick Access Toolbar" FontWeight="Bold" Margin="1,1,2,0" TextAlignment="Center"
                            BorderThickness="0,0,0,1" BorderBrush="Gray" HorizontalContentAlignment="Center"
                            VerticalContentAlignment="Center" VerticalAlignment="Top" HorizontalAlignment="Stretch"
                            Foreground="{DynamicResource {ComponentResourceKey odc:Skins, RibbonBarForgroundBrush}}"
                            Background="{DynamicResource {ComponentResourceKey odc:Skins, RibbonBarControlBrush}}" />
                </DataTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="ToolBarPlacement" Value="Bottom">
                <Setter Property="Template" Value="{StaticResource RibbonQAToolbarTemplateBottom}" />
            </Trigger>
        </Style.Triggers>
        <Style.Resources>
            <Style TargetType="{x:Type odc:RibbonButton}">
                <Setter Property="Margin" Value="-1" />
                <Setter Property="odc:RibbonBar.Size" Value="Small" />
                <Setter Property="Width" Value="24" />
                <Setter Property="CornerRadius" Value="0" />
            </Style>
            <Style TargetType="{x:Type odc:RibbonToggleButton}">
                <Setter Property="Margin" Value="-1" />
                <Setter Property="odc:RibbonBar.Size" Value="Small" />
                <Setter Property="Width" Value="24" />
                <Setter Property="CornerRadius" Value="0" />
            </Style>
            <Style TargetType="{x:Type odc:RibbonDropDownButton}">
                <Setter Property="Margin" Value="-1" />
                <Setter Property="odc:RibbonBar.Size" Value="Small" />
                <Setter Property="Width" Value="38" />
                <Setter Property="CornerRadius" Value="0" />
            </Style>
            <Style TargetType="{x:Type odc:RibbonSplitButton}">
                <Setter Property="Margin" Value="-1" />
                <Setter Property="odc:RibbonBar.Size" Value="Small" />
                <Setter Property="Width" Value="38" />
                <Setter Property="CornerRadius" Value="0" />
            </Style>
            <Style TargetType="{x:Type odc:RibbonChrome}" BasedOn="{StaticResource RibbonChromeStyle}">
                <Setter Property="CornerRadius" Value="0" />
            </Style>
        </Style.Resources>
    </Style>

</ResourceDictionary>